<template>
	<view class="all-view">
		<!-- <myLoading></myLoading> -->
		<view v-if="activityLength == 0" class="have-none-view">
			<image class="none-image" src="https://image.nanjingtouyang.com/touy/2023/11/2023110815213965869.png" mode=""></image>
			<view class="have-none-text">暂时还没有核销呢～</view>
		</view>
		<view 
			v-else
			class="activity-view-item" 
			v-for="(item, index) in activityList"
			:key="index">
			<view class="view-item">
				<view class="view-item-address">
					<image class="address-icon" src="https://image.nanjingtouyang.com/touy/2024/02/19/d208f94511994ece9bf721d4bdbb0e5f.png" mode=""></image>
					<view class="address-text">{{ item.shopName || item.addr }}</view>
				</view>
				<view class="view-item-people">
					<view class="item-people">
						<image v-if="item.userAvatar" class="head-image" :src="item.userAvatar"></image>
						<image v-else class="head-image" src="https://image.nanjingtouyang.com/touy/2023/09/2023090515054870864.png" mode=""></image>
						<view class="head-name">
							{{ item.userName }}
						</view>
					</view>
					<view class="item-type">
						<text v-show="item.aptTimeLabel == '待开始'">{{ item.aptTimeLabel }}</text>
						<text v-show="item.aptTimeLabel == '进行中'" style="color: #E02020;">{{ item.aptTimeLabel }}</text>
						<text v-show="item.aptTimeLabel == '已结束'" style="color: #666666;">{{ item.aptTimeLabel }}</text>
					</view>
				</view>
				<view class="view-item-button" @click="toCheckPeople(item)">
					<view class="button-text">核销名单</view>
					<image class="button-icon" src="https://image.nanjingtouyang.com/touy/2024/05/15/b609c1a79f5d464b98145931adcbf4c1.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { spVerifyList } from "@/api/mine.js"
	export default {
		data(){
			return{
				activityList: [],
				playType: '',
				activityLength: 1,
				checkType: ''
			}
		},
		onLoad(option){
			
			this.checkType = option.checkType
			// this.userId=uni.getStorageSync('userId')
			this.getMyActivity()
			// if(uni.getStorageSync('is_touy') == 'Y') {
			// 	this.playType = 1
			// 	this.getMyActivity()
			// } else {
			// 	this.playType = 2
			// 	this.getMyActivity()
			// }
		},
		methods: {
			dealFileType(url) {
				let reg = /^.*\.(mp|MP)4$/,
					isMp4 = reg.test(url),
					res = {};
				if (!url) return res;
				res = {
					type: isMp4 ? 'video' : 'img',
					url: isMp4 ? this.$imgUrl + url : this.$imgUrl + (url[0] === '/' ? url.slice(1) : url),
				};
				return res
			},
			toCheckPeople(item) {
				uni.navigateTo({
					url:'../../pages/check-people/index?id=' + item.aptId
				})
			},
			getMyActivity() {
				spVerifyList({
					pageNum:1,
					pageSize: 200,
					qryType: 12,
					
				}).then(res => {
					this.activityList = res.data.data
					this.activityLength = this.activityList.length
				})
			},
			
		},
	}
</script>

<style lang="scss">
	page {
		background-color: #FAFAFA;
	}
	.all-view {
		padding: 10rpx 30rpx 30rpx 30rpx;
		box-sizing: border-box;
	}
	.activity-view-item {
		width: 100%;
		background: #F9F9F9;
		border-radius: 12rpx;
		margin-top: 30rpx;
		background-color: #ffffff;
		.view-item {
			padding: 30rpx;
			box-sizing: border-box;
			background: #FFFFFF;
			border-radius: 12rpx;
			margin-bottom: 30rpx;
			.view-item-address {
				width: 100%;
				display: flex;
				justify-content: space-between;
				.address-icon {
					width: 30rpx;
					height: 30rpx;
					margin-top: 7rpx;
				}
				.address-text {
					font-weight: 500;
					font-size: 28rpx;
					color: #333333;
					line-height: 40rpx;
					width: 588rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}
			}
			.view-item-people {
				width: 100%;
				display: flex;
				justify-content: space-between;
				margin-top: 20rpx;
				border-bottom: 2rpx solid #F9F9F9;
				padding-bottom: 30rpx;
				box-sizing: border-box;
				.item-people {
					width: 500rpx;
					display: flex;
					justify-content: space-between;
					.head-image {
						width: 50rpx;
						height: 50rpx;
						border-radius: 50%;
					}
					.head-name {
						width: 430rpx;
						font-weight: 400;
						font-size: 26rpx;
						color: #333333;
						line-height: 50rpx;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
					}
				}
				.item-type {
					width: 100rpx;
					font-weight: 400;
					font-size: 26rpx;
					color: #46973B;
					line-height: 50rpx;
					text-align: center;
				}
			}
			.view-item-button {
				width: 100%;
				display: flex;
				justify-content: center;
				margin-top: 30rpx;
				.button-text {
					font-weight: 400;
					font-size: 28rpx;
					color: #46973B;
					line-height: 34rpx;
				}
				.button-icon {
					width: 24rpx;
					height: 24rpx;
					margin-left: 10rpx;
					margin-top: 6rpx;
					
				}
			}
		}
	}
	.have-none-view {
		 width: 100%;
		 height: 100vh;
		 text-align: center;
		 .none-image {
			 width: 290rpx;
			 height: 282rpx;
			 margin-top: 150rpx;
			 
		 }
		 .have-none-text {
			 font-size: 24rpx;
			 margin-top: 30rpx;
			 font-weight: 400;
			 color: #ADADAD;
		 }
	}
	
	
</style>